package 剑指offer;

public class _58翻转单词顺序I {
    public static void main(String[] args) {
        reverseWords("fdsj   fjdkls");
    }
    public static String reverseWords(String s) {
        StringBuilder stringBuilder = new StringBuilder();
        String[] s1 = s.split(" ");
        for(int i = s1.length - 1; i >= 0; i--){
            stringBuilder.append(s1[i] + " ");
            System.out.println(s1[i]);
        }
        return new String(stringBuilder).trim();
    }
}
